package utils;

import java.util.Arrays;
import java.util.Random;

/**
 * @author or2
 * @date ${DATE} ${TIME}
 */
public class ArrayGenerator {

    /**
     * 生成一个给定`规模`和`边界`的数组
     * @param size 生成数组的规模
     * @param bounds 生成数组的边界
     * @return Integer[]类型的数组
     */
    public static Integer[] generateRandomIntArr(int size, int bounds) {
        Random random = new Random();
        Integer[] ints = new Integer[size];
        for (int i = 0; i < ints.length; i++) {
            ints[i] = random.nextInt(bounds);
        }
        return ints;
    }

    /**
     * 生成给定规模的有序数组
     * @param size 数组的规模
     * @return 有序的给的规模的数组
     */
    public static Integer[] generateSortedIntArr(int size) {
        Integer[] ints = new Integer[size];
        for (int i = 0; i < size; i++) {
            ints[i] = i;
        }
        return ints;
    }

    public static Integer[] generateZeroArr(int size, int num) {
        Integer[] ints = new Integer[size];
        Arrays.fill(ints, num);
        return ints;
    }
}
